package com.tracybai.microblogging.blogoauth;

import java.util.HashMap;

//import com.theotino.weekend_entertainmentHD.log.MyLog;

public class SinaOAuthRequest extends OAuthRequest{

	public SinaOAuthRequest(String paramString1, String paramString2) {
		super(paramString1, paramString2);
	}

	@Override
	public OAuthToken getToken() {
		OAuthToken oAuthToken = null;
		/**header**/

		/**queryString**/
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			String result = http.exePost(mUrl, str);
			oAuthToken = this.extract(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return oAuthToken;
	}

	@Override
	public String pushMsg(){
		String result =null;
		/**header**/
		
		/**queryString0**/
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		try {
			result = http.exePost(mUrl,map);
//			MyLog.e("result:",result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return result;
	}
	@Override
	public String pushMsg(String pic){
		String result =null;
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		try {
			result = http.exePost(mUrl,map,pic);
//			MyLog.e("result:",result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

	@Override
	public String getWeibo() {
		String result =null;
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			result = http.exeGet(mUrl, str);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
	@Override
	public String getReview() {
		String result =null;
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			result = http.exeGet(mUrl, str);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

	@Override
	public String sendReview() {
		String result =null;
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			result = http.exePost(mUrl, str);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

	@Override
	public String sendWeiboRepost() {
		String result =null;
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			result = http.exePost(mUrl, str);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

	@Override
	public OAuthToken getAccessToken() {
		OAuthToken oAuthToken = null;
		/**queryString**/
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			String result = http.exePost(mUrl, str);
			oAuthToken = this.extract2(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return oAuthToken;
	}

	@Override
	public String getUserData() {
		String result =null;
		HashMap<String, String> map = this.getOAuthParams();
		map.putAll(this.getBodyParams());
		String str = OAuthUtils.encodeMap(map);
		try {
			result = http.exeGet(mUrl, str);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
}
